@ECHO OFF

SET CurrentFolder=%1
%CurrentFolder:~1,2%
CD "%CurrentFolder:~3,255%"

SET assemblyinfo=.\Properties\AssemblyInfo.cs

FOR /f "tokens=1,2 delims=:MSP" %%a IN ('svnversion .\') DO SET svnversion1=%%a & SET svnversion2=%%b
SET svnversion=%svnversion1%
IF NOT "%svnversion2%"=="" SET svnversion=%svnversion2%
IF "%svnversion%"=="" GOTO :SVNERROR
IF %svnversion%==exported GOTO :REPOERROR

ECHO.     Generating %assemblyinfo%...
CALL .\Properties\AssemblyInfo.bat "%assemblyinfo%" %svnversion% %DATE:~10,4%

GOTO :END


:SVNERROR

ECHO *************************************************************************************
ECHO *                                                                                   *
ECHO * AN ERROR OCCURRED GETTING THE SVN REVISION NUMBER                                 *
ECHO *                                                                                   *
ECHO * The SVN client is required in order to properly set the library's version number! *
ECHO * This can be downloaded at:                                                        *
ECHO *           http://www.sliksvn.com/en/download                                      *
ECHO *                                                                                   *
ECHO *************************************************************************************

ECHO.Error generating AssemblyInfo.cs!>%assemblyinfo%

GOTO :END


:REPOERROR

ECHO *************************************************************************************
ECHO *                                                                                   *
ECHO * AN ERROR OCCURRED GETTING THE SVN REVISION NUMBER                                 *
ECHO *                                                                                   *
ECHO * The project must be built under a properly checked out Subversion repository.     *
ECHO *                                                                                   *
ECHO *************************************************************************************

ECHO.Error generating AssemblyInfo.cs!>%assemblyinfo%

GOTO :END


:END
ECHO ON